package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"log"
)

func main() {
	r := gin.Default()
	r.POST("/upload", func(context *gin.Context) {
		// 取表单里的文件
		file, _ := context.FormFile("file")
		log.Println(file.Filename)
		// 传到根目录
		context.SaveUploadedFile(file, "./day12_gin/demo5_upload_file/"+file.Filename)

		context.String(200, fmt.Sprintf("'%s' upload success", file.Filename))
	})
	r.Run(":8000")

}
